package ModelLayer; //makes this class a part of the ModelLayer package
import java.util.*;

/**
 * 
 * <code>Loan</code> class stores information about a loan. The data in it is managed by the <code>LoanCtr</code> in the ControlLayer
 * 
 * @author (dmaj0913 - group 2) 
 * @version (2013.11.08)
 */
public class Loan
{
    private long id;
    private String borrowDate;
    private String period;
    private String state;
    private Copy copy;
    private Person person;

    /** 
     * Constructor for objects of class <code>Loan</code> creates a new Loan with all needed information.
     *@param id stores a number of type long that serves as an ID of the loan.
     *@param borrowDate stores a character string with the borrow date.
     *@param period stores a character string with the period of the loan.
     *@param state stores a character string with the state of the loan.
     *@param copy stores an object of type Copy which is borrowed by the friend.
     *@param person stores an object of type Person who borrowed the copy of the DVD.
     */
    public Loan(long id, String borrowDate, String period, String state, Copy copy, Person person)
    {
        this.id = id;
        this.borrowDate = borrowDate;
        this.period = period;
        this.state = state;
        this.copy = copy;
        this.person = person;
    }
    
    /**
     * Returns the id of the loan.
     * @return number of type long with the ID of the loan.
     */
    public long getId()
    {
        return id;
    }
    
    /**
     * Returns the borrow date when the copy was borrowed.
     * @return Character string with the borrow date of the loan.
     */
    public String getBorrowDate()
    {
        return borrowDate;
    }
 
    /**
     * Returns the period of this loan.
     * @return Character string with the period of the loan.
     */
    public String getPeriod()
    {
        return period;
    }
    
    /**
     * Returns the state of the loan.
     * @return Character string with the state of the loan.
     */
    public String getState()
    {
        return state;
    }
        
    /**
     * Updates the ID of the loan with a desired new one.
     * @param id field of type long containg the new id of the loan.
     */
    public void setId(long id)
    {
        this.id = id;
    }
    
    /**
     * Changes the borrow date of the loan.
     * @param newvar Character string with the new borrow date of the loan.
     */
    public void setBorrowDate(String newvar)
    {
        borrowDate = newvar;
    }
        
    /**
     * Replaces the name of the loan with a desired new one.
     * @param period Character string with the new period of the loan.
     */
    public void setPeriod(String period)
    {
        this.period = period;
    }
    
    /**
     * Sets the state of the loan to a desired new one.
     * @param newvar Character string with the new state of the loan.
     */
    public void setState(String newvar)
    {
        state = newvar;
    }
        
    /**
     * Returns the copy linked to the loan.
     * @return object of type Copy with the desired copy.
     */
    public Copy getCopy()
    {
        return copy;
    }
    
    /**
     * Returns the person connected to the loan(who borrowed the copy).
     * @return object of type Person with the desired person.
     */
    public Person getPerson()
    {
        return person;
    }
}
